package cn.chinawyny.boot.bootdemo;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.ExitCodeGenerator;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

@Component
public class MyCommandLineRunner implements ApplicationRunner {

    @Bean
    public ExitCodeGenerator exitCodeGenerator() {
        return () -> 42;
    }

    @Value("${local.server.port:6033}")
    private String port;


    @Override
    public void run(ApplicationArguments args) {
        // Do something...
        System.out.println(port);
    }
}